<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="JavaBean.*,Dao.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
	<%
	 request.setCharacterEncoding("UTF-8");
		UserBean users=new UserBean();
		users.setUsername(request.getParameter("username"));
		users.setPassword(request.getParameter("password"));
		users.setMark(request.getParameter("mark"));
		UserDao userDao=new UserDao();
		int result=userDao.insert(users);
		if(result>0){
			 out.println("<script>alert('插入成功！！');</script>"); 
		     out.println("<script>window.location.href='UserList.jsp'</script>");
			
		}
		if(result==-1){
			out.println("<script>alert('插入失败！！');</script>");
			out.println("<script>window.location.herf='UserList.jsp'");
		}
		if(result==-2){
			out.println("<script>alert('连接错误！！');</script>");
			out.println("<script>window.location.herf='UserList.jsp'");
		}
		
	%>
</body>
</html>